package com.flashshe.ds.list
{
	import com.flashshe.error.MethodNotImplementError;
	import com.flashshe.ds.IIterator;
	 	
	public class List extends AbstractList
	{
		private var vector:Vector.<Object> = new Vector.<Object>();
		
		
		public function List()
		{
			super();				
		}
		
		public override function get size():int
		{
			return vector.length;
		}				
		
		public override function clear():void
		{
			vector = new Vector.<Object>();
		}
											
		public override function add(v:Object):void
		{
			vector.push(v);
		}			
		
		public override function addAt(index:uint, v:Object):void
		{
			vector.splice(index, 0 , v);
		}
		
		public override function getLast():Object
		{
			return vector[size-1];
		}
		
		public override function getValueAt(index:uint):Object
		{
			return vector[index];
		}
		
		public override function setValueAt(index:uint, v:Object):Object
		{
			var result:Object = vector[index];
			vector[index] = v;
			return result;
		}		
		
		public override function removeAt(index:uint):Object
		{
			var result:Object = vector[index];
			vector.splice(index, 1);
			return result;
		}
		
		public override function remove():Object
		{
			return vector.pop();
		}				
				
		public override function indexOf(v:Object, startIndex:uint=0):int
		{
			return vector.indexOf(v, startIndex);
		}	
		
		/*public override function get iterator():IIterator
		{
			throw new MethodNotImplementError("get iterator()");
		}*/
	}
}